<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<%
String path = request.getContextPath();
pageContext.setAttribute("APP_PATH",path);
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
    <link href="${APP_PATH}/static/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="${APP_PATH}/static/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="${APP_PATH}/static/js/jquery-3.3.1.min.js"></script>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'login.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript">
  	function submitClick(){
  	var msg="";
  	if($('#password').val()==""){
  		msg+=" 岗位"
  	}
  	if($('#inputuserName').val()==""){
  		msg+=" 姓名"
  	}
  	if(msg.length>0){
	  	alert("请输入用户名及密码"+msg);
	  	return;
  	}
  	
	  	var str=$('#loginform').serialize();
	  	$.ajax({
	  		url:"${APP_PATH}/adminlogin",
	  		data:str,
	  		contentType: "application/x-www-form-urlencoded; charset=utf-8",  
	  		type:"POST",
	  		success:function(result){
	  		alert("${APP_PATH}"+result);
			  	window.open("${APP_PATH}/"+result,"_self");
	  		}
	  	});
  	};
  	
  	function dept_Change(){
  		document.getElementById("selectJob").options.length=0;
  		$.ajax({
	  		url:"${APP_PATH}/job?deptId="+$('#selectDept').val(),
	  		contentType: "application/x-www-form-urlencoded; charset=utf-8",  
	  		type:"POST",
	  		success:function(result){
	  		if(result.code==100){
	  			var jobs = result.result.jobs;
		  		$.each(jobs,function(index,job){
		  		    $("#selectJob").append("<option value='"+job.idjob+"'>"+job.jobname+"</option>");
		  		});   
            }
            else{
            	alert(result.msg)
            } 
	  		}
	  		});
  	}
  
  </script>
  <style>
    .headercolor { 
      background-color: #99d9ea; }
  </style>
  </head>
  
  <body class="headercolor">
	<br/>
	<br/>
    <h1><p class="text-center">管理员登录</p></h1>
	<br/>
	<br/>
    <form id="loginform" class="form-horizontal" method="POST" action="adminlogin">
      <div class="form-group">
      <label for="inputuserName" class="col-sm-3 control-label">账号：</label>
        <div class="col-sm-6">
          <input type="text" class="form-control" id="inputuserName" name="username" maxlength="16">
        </div>
	  </div>
	  <br/>
	  <div class="form-group">
	    <label for="inputpassword" class="col-sm-3 control-label">密码：</label>
	    <div class="col-sm-6">
	      <input type="text" class="form-control" id="inputpassword" name="password" maxlength="16">
	    </div>
	  </div>
	  <br/>
	  <div class="form-group">
	    <label for="inputtest" class="col-sm-3 control-label">验证码：</label>
	    <div class="col-sm-6">
	      <input type="text" class="form-control" id="inputtest" name="inputtest">
	    </div>
	  </div>
	  <br/>
	  <div class="form-group">
    	<p class="text-center">
     	  <button id="btn_submit" type="submit"  class="btn btn-info btn-lg">登录</button>
    	</p>
  	  </div>
    </form>
  </body>
</html>
